import React from 'react'
import { NavContent, Link } from '../../ui-components'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as systemAction from '../../actions/system.action'
import { fileUpload } from '../../actions/file.action'
import { downloadProfile, uploadProfile, createDocument } from '../../actions/onboarding.hr.action'
import { updateAvatar } from '../../actions/app.action'
import CompanySettings from './CompanySettings'

const navs = [
	[
		{name: 'companySettings', show:'公司设置'}, 
		{name: 'profileSettings', show: '花名册字段设置'},
    /*{name: 'authSettings', show: '权限配置'},*/
		{name: 'uploadProfile', show: '邀请员工'}
	] 
]

/*
export default
@connect(null, dispatch => ({actions: bindActionCreators({...systemAction, fileUpload, createDocument, updateAvatar, uploadProfile, downloadProfile }, dispatch)}))
class System extends React.Component {

	static contextTypes = {
		router: React.PropTypes.object
	}

	item = ({name, show, active, index}) => (
		<Link 
			to={`#/system/${name}`}
			active={ ~this.props.location.pathname.indexOf(name) && active} 
			size="16" 
			label={show}/>
	)

	render() {
		return (
			<NavContent 
				navs={navs} 
				item={this.item}
				{...this.props.actions}
				{...this.context}
			>
				{ this.props.children }
			</NavContent>
		)
	}
}
*/

export default
@connect(null, dispatch => ({actions: bindActionCreators({...systemAction, fileUpload, createDocument, updateAvatar, uploadProfile, downloadProfile }, dispatch)}))
class System extends React.Component {

	static contextTypes = {
		router: React.PropTypes.object
	}

	render() {
		return (
      <CompanySettings
        {...this.props.actions}
        {...this.context}
      />
		)
	}
}
